package main;

import java.io.IOException;

import p2p.FileList;
import p2p.Kwalker;
import p2p.NeighborList;
import p2p.PeerPool;

import server.RMIServer;
import ui.Terminal;

public class UIThread implements Runnable {
	private Thread runner;
	private p2p.Peer thisPeer;
	private PeerPool peerPool;
	private NeighborList neighborList;
	private FileList fileList;
	private Kwalker kWalker;
	private RMIServer s;

	public UIThread(String threadName, RMIServer s, p2p.Peer thisPeer, PeerPool peerPool, NeighborList neighborList, FileList fileList, Kwalker kWalker) {
		this.thisPeer = thisPeer;
		this.peerPool = peerPool;
		this.neighborList = neighborList;
		this.fileList = fileList;
		this.kWalker = kWalker;
		runner = new Thread(this, threadName); // (1) Create a new thread.
		runner.start(); // (2) Start the thread.
		this.s = s;
	}
	
	public void run() {
		Terminal terminal = new Terminal();
		try {
			terminal.runTerminal(s, thisPeer, peerPool, neighborList, fileList, kWalker);
		} catch(IOException e) {
			
		}
	}
}